import Route from '@ioc:Adonis/Core/Route'
import Redis from "@ioc:Adonis/Addons/Redis";
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
import DeliversController from "App/Controllers/Http/DeliversController";
Route.post('/getDeliverData', async (ctx: HttpContextContract) => {
     let deliverController=new DeliversController();
     let result=await deliverController.getDeliverData(ctx);
     return result;
});
//删除
Route.post('/deleteDeliverData', async (ctx: HttpContextContract) => {
  let deliverController=new DeliversController();
  let result=await deliverController.deleteDeliverData(ctx);
  return result;
});
Redis.subscribe('add:order', (orderInfo: string) => {
     let data=JSON.parse(orderInfo);
     let deliverController=new DeliversController();
     deliverController.addDeliver(data);
});

